打开配置文件
1 | vim /etc/profile |
末尾加入jdk路径
1 | export JAVA_HOME=/home/java/jdk1.8.0_211 |
使环境变量生效
1 | source /etc/profile |
查看jdk版本
1 | java -version |
错误提示,添加对应文件夹权限
-bash: /home/java/jdk1.8.0_211/bin/java: Permission denied
1 | chmod 777 /home/java/jdk1.8.0_211/bin/java |